<template>
  <div>
    <el-row :gutter="10" style="margin-bottom: 60px">
      <el-col :span="6">
        <el-card>
          <div style="color: #409EFF"><i class="el-icon-user-solid" style="margin-right: 5px"/>用户总数</div>
          <div style="padding: 10px 0; text-align: center; font-weight: bold">
            100
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <div style="color: #F56C6C"><i class="el-icon-s-cooperation" style="margin-right: 5px"/>销售总量</div>
          <div style="padding: 10px 0; text-align: center; font-weight: bold">
            ￥ 1000000
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <div style="color: #E6A23C"><i class="el-icon-s-goods" style="margin-right: 5px"/>收益总额</div>
          <div style="padding: 10px 0; text-align: center; font-weight: bold">
            ￥ 400000
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <div style="color: #67C23A"><i class="el-icon-s-shop" style="margin-right: 5px"/>门店总数</div>
          <div style="padding: 10px 0; text-align: center; font-weight: bold">
            88
          </div>
        </el-card>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <div id="main" style="width: 500px; height: 500px"></div>
      </el-col>
      <el-col :span="12">
        <div id="pie" style="width: 500px; height: 500px"></div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import * as echarts from 'echarts';

export default {
  name: "Home",
  data() {
    return {}
  },
  mounted() {
    // 折线图
    let chartDom = document.getElementById('main');
    let myChart = echarts.init(chartDom);
    let option = {
      title: {
        text: '各季度会员统计',
        subtext: '趋势图',
        left: 'center'
      },
      tooltip:{
        trigger: 'item'
      },
      legend:{
        orient: 'vertical',
        left: 'left'
      },
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          name: '星巴克',
          data: [110, 170, 224, 218, 135, 147, 260],
          type: 'line'
        },
        {
          name: '瑞信咖啡',
          data: [110, 170, 224, 218, 135, 147, 260],
          type: 'bar'
        }
      ]
    };
    myChart.setOption(option);

    // 饼图
    let pieDom = document.getElementById('pie');
    let pieChart = echarts.init(pieDom);
    let pirOption = {
      title: {
        text: '各季度会员汇总',
        subtext: '占比图',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: '60%',
          data: [
            { value: 1048, name: 'Search Engine' },
            { value: 735, name: 'Direct' },
            { value: 580, name: 'Email' },
            { value: 484, name: 'Union Ads' },
            { value: 300, name: 'Video Ads' }
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    };
    pieChart.setOption(pirOption);
  }
}
</script>

<style scoped>

</style>
